ActionController::Routing::Routes.draw do |map|
  # Users
  map.logout '/logout', :controller => 'sessions', :action => 'destroy'
  map.login '/login', :controller => 'sessions', :action => 'new'
  map.resource :session
  map.resources :hour, :collection => { :punch_in => :post, :punch_out => :post }

  # Admin
  map.namespace :admin do |admin|
    admin.resources :users do |user|
      user.resources :offs
      user.resources :hour_banks
    end
    admin.resources :departments
    admin.resources :reports, :collection => { :hour_bank => :get, :holidays => :get, :users => :get, :hours => :get, :update_reports => :get }
    admin.resources :companies, :member => { :add_branch_office => :put, :remove_branch_office => :delete, :edit_branch_office => :get, :update_branch_office => :put }
  end

  # Default
  map.root :controller => "home"

  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'
end
